C++小程序中的问题{很急!!!}

来源:百度知道 编辑:UC知道 时间:2024/06/22 09:50:31
本人是个菜鸟,初学C++时,想用VC++6.0编译下列程序:

1)创建一个工程文件exam,然后创建一个C++ Source File 文件cppl.cpp,将它加入到工程exam中。cppl.cpp文件内容如下:
#include <iostream>
using namespace std;
int max(int a,int b)
{if(a>b)
return a;
else
return b;
}

请求用VC++建立以上程序,并可以运行。
不好意思了,原来是我把题看错了,这是一个多文档程序,后面还有内容,现在问题已经解决了,但是积分还是要送给朋友的!
谢谢各位!!

创建一个工程文件exam:
打开VC,文件->新建->工程
选择“Win32 Console Application”
并在工程名称上填上“con1”,按确定
选择“一个简单的程序[S]”,按完成

创建一个C++ Source File 文件cppl.cpp,将它加入到工程exam中:
工程->添加到工程->新建->文件
选择“C/C++ Header File”,并在文件上名填上“cpp1.cpp”,确定
按 内容复制到cpp1.cpp里面
#include "stdafx.h"
#include <iostream>
using namespace std;
int max(int a,int b)
{
if(a>b)
return a;
else
return b;
}
点在左边的FileView,双击Source Files->c3.cpp,将下面的内容替换里面的内容
#include "stdafx.h"
#include <iostream>
using namespace std;

int max(int a,int b);

int main(int argc, char* argv[])
{
int a=1;
int b=2;
int c=max(a,b);
cout << c;
return 0;
}

什么意思..你这个应该是一部分代码吧? main函数都没有

你这应该是给一个函数定义的吧。
具体你要干什么也没说清楚啊。
是不是想自己建立一个函数呢,如果是就给我送个消息吧,看能不能帮你什么忙。

#include <iostream>
using namespace std;